import sys
import functools
 # -*- coding: utf-8 -*-
 #关键字参数
def parrot(voltage,state='a stiff',action='voom',type='Norwegian Blue'):
	print("--This parrot wouldn't",action)
	print('if you put',voltage,'volts trough it')
	print('--Lovely plumage,the',type)
	print("--It's",state)
parrot(voltage='test')

dic={1:3,2:4}
print(dic)

def cheeseshop(**kewords):
	for kw in kewords:print(kw,kewords[kw])
print(cheeseshop(a=1,b=2))

arr=[1,2,3,4,6,7,8]

#映射，将算法施与容器中每个元素，将返回值合并为一个新容器
def map_func(list):
	return list+9
#过滤，将算法施与容器每个元素，将返回值为真的元素合并为一个新的容器
def filter_func(list):
	return list>5
#合并，将算法以此施与容器中的每个元素，将返回值座位下一步计算的初始值，与下一个元素再计算，直至最终获得一个总的结果
def reduce_func(l1,l2):
	return l1+l2

map_1=map(map_func,arr)
filter_1=filter(filter_func,arr)
reduce_1=functools.reduce(reduce_func,arr)
print(list(map_1))
print(list(filter_1))
print(reduce_1)